﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading;

namespace DataLayer.Model.Objects
{
    [DataContract]
    public class Command : Action
    {
        [DataMember]
        public String Target;

        public override string FormSlachCommand()
        {
            if (Target == null)
                Target = String.Empty;
            if (Name == null)
                Name = String.Empty;
            return string.Format("{0} {1}", Name, Target);
        }

        public override void DoAction()
        {
            var commandText = FormSlachCommand();
            Singleton.Terminal.SendCommand(commandText, Thread.CurrentThread.Name);
        }
    }
}
